﻿using EquipmentManagement.Application.IServices;
using EquipmentManagement.Domain.Entities;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Standard;
using Standard.Dtos;

namespace EquipmentManagement.ApiHost.Controllers
{
    /// <summary>
    /// 工装夹具管理
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ToolingFixturesController : ControllerBase
    {
        private readonly IToolingFixturesService _toolingfixtures;

        public ToolingFixturesController(IToolingFixturesService toolingfixtures)
        {
            _toolingfixtures = toolingfixtures;
        }
        /// <summary>
        /// 添加接口
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public ApiResult<int> Add(ToolingFixtures model)
        {
            return _toolingfixtures.Add(model);
        }
        /// <summary>
        /// 删除接口
        /// </summary>
        [HttpDelete]
        public ApiResult<int> Delete(string id)
        {
            return _toolingfixtures.Delete(id);
        }
        /// <summary>
        /// 获取接口(分页+条件查询)
        /// </summary>
        /// <param name="paging">分页数据</param>
        /// <param name="SerialNumber">序列号</param>
        /// <param name="TypeId">类型</param>
        /// <param name="UnitId">单位</param>
        /// <returns></returns>
        [HttpGet]
        public ApiResult<ToolingFixtures> Get([FromQuery]PagingInput paging, string? SerialNumber, string? TypeId, string? UnitId)
        {
            return _toolingfixtures.Get(paging,SerialNumber,TypeId,UnitId);
        }
        /// <summary>
        /// 修改接口
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPut]
        public ApiResult<int> Update(ToolingFixtures model) 
        {
            return _toolingfixtures.Update(model);
        }
    }
}
